package Java网络编程.TCP通信程序练习.p3_服务器数据写入文本文件;

import java.io.*;
import java.net.Socket;

/*数据来自键盘录入，直到886停止*/
public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.189.1",2);

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));

        String line;
        while((line=br.readLine())!=null){
            if("886".equals(line)){
                break;
            }else {
                bw.write(line);
                bw.newLine();
                bw.flush();
            }
        }

        s.close();

    }
}
